﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;

public partial class kecheng_mp_viewPlay : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            getList();
        }
    }
    /// <summary>
    /// 获取课程内容列表
    /// </summary>
    private void getList()
    {
        if (Request["id"] != null)
        {
            string id = Request["id"];
            if (!Regex.IsMatch(id, "^[0-9]*$"))
            {
                messageBox(false, "", "参数不合法！");
            }
            //绑定播放列表
            using (Conn sqlCon = new Conn())
            {
                    string sql = string.Format("select title_id,f_topic=replace(f_topic,'/',''),f_title,f_content,f_writer,f_imp,f_read,f_date,f_date1 from bbs where replace(f_topic,'/','')=(select f_topic=replace(f_topic,'/','') from bbs where title_id={0})order by title_id", id);
                    playlist.DataSource = sqlCon.GetGrid(sql, "list");
                    playlist.DataBind();
            }
        }
   
    }
    /// <summary>
    /// 提示消息
    /// </summary>
    /// <param name="tag"></param>
    /// <param name="message">正确时提示消息</param>
    /// <param name="message1">错误时提示消息</param>
    void messageBox(bool tag, string message, string message1)
    {
        if (tag)
        {
            Response.Write(string.Format("<script language='javascript'>alert('{0}');</script>", message));
        }
        else
        {
            Response.Write(string.Format("<script language='javascript'>alert('{0}');</script>", message1));
        }
    }
}
